package com.d2rv.offscreen;

import com.d2rv.guide.GoalManager;
import com.d2rv.model.CityModelManager;
import com.d2rv.settings.Settings;
import com.d2rv.skybox.SkyboxManager;
import com.d2rv.user.UserManager;
import processing.core.PApplet;

/**
 * This class is the manager of the offscreen side by side.
 *
 * @author Darrieutort A., Dupouy A., Rossignol L., Van Poucke A.
 */
public class SideBySideManager {

    private OffScreenUserSideBySide offscreenusersidebysideleft;
    private OffScreenUserSideBySide offscreenusersidebysideright;

    /**
     *
     * Default constructor.
     * 
     * @param parent the current application
     * @param usermanager the manager of the user
     * @param citymodelmanager the manager of the city model
     * @param skyboxmanager the manager of the skybox
     * @param goalmanager the manager of the goal
     */
    public SideBySideManager(PApplet parent, UserManager usermanager, CityModelManager citymodelmanager, SkyboxManager skyboxmanager, GoalManager goalmanager) {
        this.offscreenusersidebysideleft = new OffScreenUserSideBySide(parent, parent.width / 2, parent.height, usermanager, citymodelmanager, skyboxmanager, goalmanager);
        this.offscreenusersidebysideright = new OffScreenUserSideBySide(parent, parent.width / 2, parent.height, usermanager, citymodelmanager, skyboxmanager, goalmanager);
    }

    /**
     * Calls the draw method of the offscreen user side by side left and right.
     */
    public void draw() {
        Settings s = Settings.getInstance();
        this.offscreenusersidebysideleft.draw(+s.offseteyes());
        this.offscreenusersidebysideright.draw(-s.offseteyes());
    }

    /**
     * Calls the show method the offscreen user side by side left and right
     *
     * @param parent the current application
     * @param x the x coordinate of the left corner of the offscreen
     * @param y the y coordinate of the left corner of the offscreen
     */
    public void show(PApplet parent, int x, int y) {
        this.offscreenusersidebysideleft.show(parent, x, y);
        this.offscreenusersidebysideright.show(parent, x + parent.width / 4, y);
    }
    
    /**
     * Returns the left offscreen user side by side
     * @return the left offscreen user side by side
     */
    public OffScreenUserSideBySide offscreenusersidebysideleft() {
        return this.offscreenusersidebysideleft;
    }
    
    /**
     * Returns the right offscreen user side by side
     * @return the right offscreen user side by side
     */
    public OffScreenUserSideBySide offscreenusersidebysideright() {
        return this.offscreenusersidebysideright;
    }
}